<template>
  <el-menu-item :index="item.id" @click="goRoute(item)">
    <i :class="item.icon" v-if="item.icon"></i>
    <span slot="title">{{ item.name }}</span>
  </el-menu-item>
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
import { MenuItem } from '@/types/index.ts'

@Component({
  name: 'onemenu'
})
export default class OneMenu extends Vue {
  @Prop() private item!: MenuItem

  private goRoute(item: MenuItem) {
    this.$router.push({
      path: item.route
    })
  }
}
</script>

<style lang="stylus" scoped></style>
